package com.naiterui.ehp.bs.patient.constants;

import com.naiterui.ehp.bp.constants.CommonConstant;

/**
 * @author zhoupeipei
 * @date 2019-06-12 22:08
 * @since 1.0.0
 */
public class CacheConstant {

    private static final String WECHAT_MESSAGE_LOCK_PRE = CommonConstant.REDIS_PRE_PT + "WECHAT_MEAASGE_LOCK_";

    public static final String PATIENT_DISEASE_IMG_SN = CommonConstant.REDIS_PRE_PT + "disease_img_sn";

    public static final int MESSAGE_HANDLE_NORMAL = 0;
    public static final int MESSAGE_HANDLE_REDIRECT = 1;

    /**
     * 获取微信回调消息锁缓存key
     *
     * @param sign <p>普通消息，sign为消息id ：msgid</p>
     *             <p>时间消息为用户openid加请求时间戳 ： openId_42571352</p>
     *
     * @return
     */
    public static String getWechatMessageLockKey(String sign) {
        return WECHAT_MESSAGE_LOCK_PRE + sign;
    }

    /**
     * 医患会话SessionKey
     *
     * @param doctorId
     * @param patientId
     *
     * @return
     */
    public static String getSessionKey(Long doctorId, Long patientId) {
        return doctorId + "_" + patientId;
    }

    /**
     * 患者付费咨询，预置病历、病情数据
     *
     * @param doctorId
     * @param patientId
     *
     * @return
     */
    public static String getSessionPrepareKey() {
        return CommonConstant.REDIS_PRE_PT + "session_record";
    }

    /**
     * 患者付费咨询，预置病历、病情数据
     *
     * @param type
     * @param recordId
     *
     * @return
     */
    public static String getSessionPrepareValue(Integer type, String recordId) {
        return type + "_" + recordId;
    }

    /**
     * 医患视频会话SessionKey
     *
     * @param doctorId
     * @param patientId
     *
     * @return
     */
    public static String getVideoSessionKey(Long doctorId, Long patientId) {
        return "video_consult_" + doctorId + "_" + patientId;
    }

    /**
     * 患者第一次绑定医生
     *
     * @param doctorId
     * @param patientId
     *
     * @return
     */
    public static String getFirstBindKey(Long doctorId, Long patientId) {
        return CommonConstant.PATIENT_PERSONAL_DOCTOR_FIRST_BIND + doctorId + "_" + patientId;
    }

    /**
     * 就诊人已完善key
     * @param inquirerId
     * @return
     */
    public static String getInquirerInfoPerfectKey(Long inquirerId){
        return CommonConstant.REDIS_PRE_PT + "inquirer_info_perfect_" + inquirerId;
    }
}
